(ns util.mekit
  (:use util.utils
        util.file))

(defn- is-mekit-home? [p]
  (and p
       (file-exists? p)
       (file-exists? (file-join p "bin" "mekit.bat"))
       (file-exists? (file-join p "src" "util" "mekit.clj"))
       p))

(defn mekit-home [] ; TODO: probably not working perfectly.
  (or (is-mekit-home? (System/getenv "MEKIT"))
      (is-mekit-home? (file-dirname (get-resource "util/mekit.clj") 3))
      (throw (java.io.FileNotFoundException. "Mekit Home"))))
